#!/bin/sh

# $Id: debug,v 1.1 2009-08-02 03:36:18 brian Exp $
# Copyright (c)2009 Brian Manning <brian at portaboom dot com>

# PLEASE DO NOT E-MAIL THE AUTHOR ABOUT THIS SOFTWARE
# The proper venue for questions is the LACK mailing list at:
# http://groups.google.com/linuxack or <linuxack.googlegroups.com>

# a debugging script; to be used to dump the environment at a specified time

# picks up things like colorize()
if ! [ -e $LACK_FUNCTIONS ]; then
    LACK_FUNCTIONS="/etc/scripts/lack_functions.sh"
fi # if ! [ -e $LACK_FUNCTIONS ]
source $LACK_FUNCTIONS

ACTION=$1
BASENAME="debugging"

case "$ACTION" in
  vars)
    # echo out what commandline variables are parsed by this script
    echo "${BASENAME}:"
    exit 0
  ;;
  start)
    colorize_nl $S_INFO "${BASENAME}: Dumping debug info: environment"
    set
    colorize_nl $S_INFO "${BASENAME}: Dumping debug info: /proc/cmdline"
    cat /proc/cmdline
    colorize_nl $S_INFO "${BASENAME}: Dumping debug info: modules"
    /sbin/lsmod
    colorize_nl $S_INFO "${BASENAME}: Dumping debug info: network"
    /sbin/ifconfig
    colorize_nl $S_INFO "${BASENAME}: Dumping debug info: routing"
    /bin/netstat
    ;;
  stop)
    :
    ;;
  restart|force-reload)
     $0 stop
     $0 start
    ;;
  *)
    echo "Usage: $BASENAME {start|stop|restart|force-reload}" >&2
    exit 3
    ;;
esac

exit 0
# vi: set shiftwidth=4 tabstop=4 filetype=sh :
# конец!
